<?php echo $this->Html->link('Verhuuritem Toevoegen', array('controller' => 'verhuuritems', 'action' => 'add')); ?>
<table>
    <thead>
        <td>Naam</td>
        <td>Prijs</td>
        <td>Acties</td>
    </thead>

<?php
foreach($verhuuritems as $verhuuritem){ ?>
    <tr>
        <td><?php echo $this->Html->link($verhuuritem['Verhuuritem']['naam'],
                array('controller' => 'verhuuritems',
                    'action' => 'view',
                    $verhuuritem['Verhuuritem']['id'])); ?></td>
        <td><?php echo $verhuuritem['Verhuuritem']['prijs']; ?>€</td>
        <td><?php echo $this->Html->link("edit",
                array('controller' => 'verhuuritems', 'action' => 'edit', $verhuuritem['Verhuuritem']['id'])); ?>|
            <?php echo $this->Html->link("delete",
                array('controller' => 'verhuuritems','action' => 'delete',$verhuuritem['Verhuuritem']['id']));
            ?>|
            <?php echo $this->Html->link('add to cart','',array('class'=>'button', 'id'=>'addToCartLink'.$verhuuritem['Verhuuritem']['id']));

                $this->Js->get('#addToCartLink'.$verhuuritem['Verhuuritem']['id']);
                $this->Js->event('click',
                        $this->Js->request(array(
                        'action' => 'addToCart',$verhuuritem['Verhuuritem']['id']), array(
                        'async' => true,
                        'update' => '#cart')));
            ?>
        </td>
    </tr>

<?php } ?>
</table>

<div id="cart">
    <h1>Cart contains:</h1>
    <ul>
        <?php
        foreach ($cartitems as $itemid){ ?>
        <li><?php echo $itemid; ?></li>
        <?php }
        ?>
    </ul>
</div>
<br />
<p>
**check for development: loaded many to many relations verhuuritems -> cart
<?php 

print_r($verhuuritems);


?>
</p>